#ifndef INTERNAL_ANALOG_DIGITAL_CONVERTER
#define	INTERNAL_ANALOG_DIGITAL_CONVERTER

#include "IAnalogDigitalConverter.h"

/*! \brief Allows reading and writing to the PIC32 internal 10-bit
 * Analog-To-Digital (ADC) device
 *
 * Allows reading and writing to the PIC32 internal 10-bit
 * Analog-To-Digital (ADC) device
 *
 * Each pin passed as inputs causes a new ADC buffer to be created. These
 * buffers are asigned LSB first.
 *
 * Example: Adc(BIT_4 | BIT_2) will create two channels, 0 and 1. Channel 0
 * will be assigned to BIT_2 while channel 1 will be assigned BIT_4.
 *
 * No attempt is made by the Adc class to keep track of inputs and channel
 * assignments. If the application opens additional inputs, the channel
 * buffers will be reassigned. The Adc class will NOT be aware of this
 * reassignment.
 */
class InternalAnalogDigitalConverter : public IAnalogDigitalConverter
{
  public:
	InternalAnalogDigitalConverter(
							UINT32 inputs,
							float referenceVoltage,
							unsigned char bitResolution);

	virtual ~InternalAnalogDigitalConverter();
	virtual float Read(UINT32 channel);
	virtual void SetReferenceVoltage(float referenceVoltage);

  private:
	float _referenceVoltage;
	UINT32 _quantizationLevels;

};

#endif

